<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
		"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
	<title>doh.robot DnD Test</title>

	<style>
		@import "../../../../util/doh/robot/robot.css";
	</style>

	<!-- required: dojo.js -->
	<script type="text/javascript" src="../../../../dojo/dojo.js"
		djConfig="isDebug: true, parseOnLoad: true"></script>
	<script type="text/javascript">
		dojo.require("dojo.robotx");

		dojo.addOnLoad(function(){
			var container1;
			var container2;
			var container3;
			var container4;
			var container5;

			doh.robot.initRobot('../test_dnd.html');

			doh.register('dojox.robot.AutoGeneratedTestGroup',{
				name: 'autotest0',
				timeout: 9875,
				setUp: function(){
					container1=dojo.byId('container1');
					container2=dojo.query("div[jsid='c2']")[0];
					container3=dojo.query("div[jsid='c3']")[0];
					container4=dojo.query("div[jsid='c4']")[0];
					container5=dojo.query("div[jsid='c5']")[0];
				},
				runTest: function(){
					var count1=dojo.query("div", container1).length;
					dojo.query("div", container2);
					var count2=dojo.query("div", container2).length; // FIXME: dojo.query returns 2 different sets on FF2
					var d = new doh.Deferred();
					doh.robot.mouseMoveAt('dojoUnique13', 2034, 100, 9, 4);
					doh.robot.mousePress({left:true, middle:false, right:false}, 1);
					doh.robot.mouseMoveAt('dojoUnique13', 1, 100, 6, 10);
					doh.robot.mouseMoveAt(container2, 1402);
					doh.robot.mouseRelease({left:true, middle:false, right:false}, 2093);
					doh.robot.sequence(function(){
						// assert container1 has -1 elements, container2 has +1
						if((dojo.query("> div", container1).length==(count1-1))&&(dojo.query("> div", container2).length==(count2+1))){
							d.callback(true);
						}else{
							d.errback(new Error("Wrong number of items in containers 1 and 2"));
						}
					}, 1000);
					return d;
				}
			});
			doh.register('dojox.robot.AutoGeneratedTestGroup',{
				name: 'autotest1',
				timeout: 7298,
				runTest: function(){
					var count1=dojo.query("> div", container1).length;
					var count2=dojo.query("> div", container2).length;
					var d = new doh.Deferred();
					doh.robot.mouseMoveAt(document.getElementsByTagName('STRONG')[0], 633, 100, 2, 6);
					doh.robot.mousePress({left:true, middle:false, right:false}, 3);
					doh.robot.mouseMoveAt(document.getElementsByTagName('STRONG')[0], 1, 100, 3, 6);
					doh.robot.mouseMoveAt(container1, 663);
					doh.robot.mouseRelease({left:true, middle:false, right:false}, 240);
					doh.robot.sequence(function(){
						// assert container1 has +1 elements, container2 has same
						if((dojo.query("> div", container1).length==(count1+1))&&(dojo.query("> div", container2).length==count2)){
							d.callback(true);
						}else{
							d.errback(new Error("Wrong number of items in containers 1 and 2"));
						}
					}, 1000);
					return d;
				}
			});
			doh.register('dojox.robot.AutoGeneratedTestGroup',{
				name: 'autotest2',
				timeout: 7587,
				runTest: function(){
					var count2=dojo.query("> div", container2).length;
					var count5=dojo.query("> div", container5).length;
					var d = new doh.Deferred();
					doh.robot.mouseMoveAt('dojoUnique11', 270, 100, 20, 6);
					doh.robot.mousePress({left:true, middle:false, right:false}, 3);
					doh.robot.mouseMoveAt('dojoUnique11', 1, 100, 21, 6);
					doh.robot.mouseMoveAt(container2, 540);
					doh.robot.mouseRelease({left:true, middle:false, right:false}, 693);
					doh.robot.sequence(function(){
						// assert container2 has +0 elements, container5 has +0
						if((dojo.query("> div", container2).length==count2)&&(dojo.query("> div", container5).length==count5)){
							d.callback(true);
						}else{
							d.errback(new Error("Wrong number of items in containers 2 and 5"));
						}
					}, 1000);
					return d;
				}
			});
			doh.run();
		});
	</script>
</head>
</html>